class smx_mount {
  require smx_os

  file { "/vagrant/nfs" :
    ensure => directory,
    owner  => vagrant, group => vagrant,
  }

  file { "/opt/foxitcloud" :
    ensure => directory,
    owner  => vagrant, group => vagrant,
  }

  if $fqdn =~ /^[a-z0-9]+\.[a-z0-9-]+\.foxitcloud\.com/ {
    #  Non-production environment
    file { '/opt/foxitcloud/nfs':
      ensure  => 'link',
      force   => true,
      target  => "/vagrant/nfs",
      require => File['/vagrant/nfs'] }
    file { ["/opt/foxitcloud/nfs/A2Tempstore","/opt/foxitcloud/nfs/cmis","/opt/foxitcloud/nfs/s3","/opt/foxitcloud/nfs/webpdf"]:
      ensure  => 'directory',
      owner   => vagrant, group => vagrant, mode => 777,
      require => File['/opt/foxitcloud/nfs'], }
  }
  else {
    file { "/opt/foxitcloud/nfs" :
      ensure => directory,
      owner  => vagrant, group => vagrant,
      before => Mount['/opt/foxitcloud/nfs'], }

    mount { "/opt/foxitcloud/nfs":
      ensure  => mounted,
      device  => "nfs.foxitcloud.com:/opt/foxitcloud/shared",
      fstype  => nfs,
      options => "rw,,soft,lookupcache=positive"; }
    file { ["/opt/foxitcloud/nfs/A2Tempstore","/opt/foxitcloud/nfs/cmis","/opt/foxitcloud/nfs/s3","/opt/foxitcloud/nfs/webpdf"]:
      ensure  => 'directory',
      owner   => vagrant, group => vagrant, mode => 777,
      require => File['/opt/foxitcloud/nfs'], }
  }

}
